<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>添加事件</title>
	<meta name="decorator" content="default"/>
</head>
<body>
<ul class="nav nav-tabs">
	<li><a href="${ctx}/business/course/">课程信息表列表</a></li>
	<li class="active"><a href="${ctx}/business/course/addevent?id=${course.id}" >
		<shiro:hasPermission name="business:course:addevent">添加事件实例</shiro:hasPermission>
	</a></li>
</ul>
<div class="container-fluid breadcrumb">
	<div class="row-fluid span12">
		<span class="span4">课程序号: ${course.seq}</span>
		<span class="span4">课程名称: ${course.title}</span>
		<span class="span4">课程介绍: ${course.introduction}</span>
	</div>
	<div class="row-fluid span12">
		<span class="span4">是否免费: ${dic:getLabelByValue(course.free, 'course_if_free')}</span>
		<span class="span4">主将老师: ${course.teacher.name}</span>
	</div>
	<div class="row-fluid span12">
		<img src="${course.cover}?x-oss-process=style/list">
	</div>
</div>
<tags:message content="${message}"/>
<div class="breadcrumb">
	<form id="form" action="${ctx}/business/eventcase/saveevent2" method="post" class="hide">
		<input type="hidden" name="courseid" value="${course.id}"/>
		<input type="hidden" name="eventid"  id="eventid"/>
	</form>
	<input id="assignButton" class="btn btn-primary" type="button" value="添加事件"/>
	<script type="text/javascript">
        $("#assignButton").click(function(){
            top.$.jBox.open("iframe:${ctx}/business/event/select3?courseid=${course.id}", "添加事件",810,$(top.document).height()-240,{
                buttons:{"确定添加":"ok", "清除已选":"clear", "关闭":true}, bottomText:"通过勾选时间后面的复选框进行添加事件。",submit:function(v, h, f){
                    var pre_ids = h.find("iframe")[0].contentWindow.pre_ids;
                    var ids = h.find("iframe")[0].contentWindow.ids;
                    if (v=="ok"){
                        var can=h.find("iframe")[0].contentWindow.can();
                        if (can=="")
                            top.$.jBox.tip("未给课程【${course.title}】分配新成员！", 'info');
                        else {
                            loading('正在提交，请稍等...');
                            //提交代码
                            $("#eventid").val(can);
                            $("#form").submit();
                            return true;
                        }
                        return false;
                    } else if (v=="clear"){
                        h.find("iframe")[0].contentWindow.clsCheckbox();
                        return false;
                    }
                }, loaded:function(h){
                    $(".jbox-content", top.document).css("overflow-y","hidden");
                }
            });
        });
	</script>
</div>
<form id="inputForm22" type="hidden">
	<input type="hidden" id="eventcaseid" name="eventcaseid">
	<input type="hidden" name="courseid" value="${course.id}">
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr><th>事件名称</th><th>事件描述</th><th>事件类型</th><th>事件开始时间</th><th>事件结束时间</th>
			<shiro:hasPermission name="business:course:addevent">
				<th>操作</th>
			</shiro:hasPermission></tr></thead>
		<tbody>
		<c:forEach items="${eventlist}" var="event">
			<tr>
				<td>${event.name}</td>
				<td>${event.description}</td>
				<td>${dic:getLabelByValue(event.type, 'event_type')}</td>
				<td>${event.startTime}</td>
				<td>${eevent.endTime}</td>
				<shiro:hasPermission name="business:course:addevent"><td>
					<a href="${ctx}/business/event/removeeventcase3?courseid=${course.id}&eventcaseid=${eventcase.id}"
					   onclick="return confirmx('确认要将事件实例从<b>[${eventcase.remarks}]</b>从<b>[${course.title}]</b>课程中移除吗？', this.href)">移除</a>
				</td></shiro:hasPermission>
			</tr>

		</c:forEach>
		</tbody>
	</table>
</form>
</body>
</html>
